package com.uyayo.framework.pagehelper;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.util.Objects;

/**
 * 排序参数类
 * uyayo-framework-pagehelper
 * Created by hfj on 2018/1/13.
 */
@ApiModel(value = "排序参数类")
public class SortOrder implements Serializable {

    private static final long serialVersionUID = -7814132188740296590L;
    /**
     * 排序属性
     */
    @ApiModelProperty("排序属性")
    private String property;

    /**
     * 排序类型（desc,asc）
     */
    @ApiModelProperty("排序类型（desc,asc）")
    private String order;

    public SortOrder() {
    }

    public SortOrder(String property, String order) {
        this.property = property;
        this.order = order;
    }

    public String getProperty() {
        return property;
    }

    public void setProperty(String property) {
        this.property = property;
    }

    public String getOrder() {
        return order;
    }

    public void setOrder(String order) {
        this.order = order;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof SortOrder)) return false;
        SortOrder sortOrder = (SortOrder) o;
        return Objects.equals(property, sortOrder.property) &&
                Objects.equals(order, sortOrder.order);
    }

    @Override
    public int hashCode() {
        return Objects.hash(property, order);
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("SortOrder{");
        sb.append("property='").append(property).append('\'');
        sb.append(", order='").append(order).append('\'');
        sb.append('}');
        return sb.toString();
    }


}
